<?php

	header("Cache-Control: no-cache, must-revalidate");

	session_start();

	require_once ("view/HTMLPageView.php");

	/*
	 * Saves name for later return
	 */
	if (isset($_SESSION["session_name"]))
	{
		$returningName = $_SESSION["session_name"];
	}
	else
	{
		$returningName = null;
	}
	/*
	 * Unsets old cookies (if existing)
	 */
	unset($_SESSION["session_name"], $_SESSION["session_password"]);

	session_regenerate_id();

	setcookie("Name", "", time() - 3600);
	setcookie("Password", "", time() - 3600);

	$pageView = new \view\HTMLPageView();
	echo $pageView->getPage
	("Du har nu loggat ut. Välkommen åter!", "Ej Inloggad", $returningName);
